const FIVE_ELEMENT_DEF = {
  /** 金 */
  METAL: {
    value: 'METAL',
    label: '金',
  },
  /** 木 */
  WOOD: {
    value: 'WOOD',
    label: '木',
  },
  /** 水 */
  WATER: {
    value: 'WATER',
    label: '水',
  },
  /** 火 */
  FIRE: {
    value: 'FIRE',
    label: '火',
  },
  /** 土 */
  EARTH: {
    value: 'EARTH',
    label: '土',
  },
} as const;

/** 灵根常量 */
export const FIVE_ELEMENT = Object.fromEntries(
  (Object.keys(FIVE_ELEMENT_DEF) as Array<keyof typeof FIVE_ELEMENT_DEF>).map(
    (k) => [k, FIVE_ELEMENT_DEF[k].value]
  )
) as {
  readonly [K in keyof typeof FIVE_ELEMENT_DEF]: (typeof FIVE_ELEMENT_DEF)[K]['value'];
};

/** 灵根映射 */
export const FIVE_ELEMENT_MAP = Object.fromEntries(
  (Object.keys(FIVE_ELEMENT_DEF) as Array<keyof typeof FIVE_ELEMENT_DEF>).map(
    (k) => [FIVE_ELEMENT_DEF[k].value, FIVE_ELEMENT_DEF[k]]
  )
) as {
  readonly [K in keyof typeof FIVE_ELEMENT_DEF]: (typeof FIVE_ELEMENT_DEF)[K];
};

/** 灵根类型 */
export type FiveElement = (typeof FIVE_ELEMENT)[keyof typeof FIVE_ELEMENT];
